package thread.threaddemo;

/**
 * @Author: wenjingyuan
 * @Date: 2022/11/01/20:18
 * @Description:实现runnable接口，新建线程
 */
public class ThreadDemo4 {
    public static void main(String[] args) {
        //先创建Runnable
        MyThread2 myThread2=new MyThread2();
        //在创建线程
        Thread thread=new Thread(myThread2);
        //执行线程
        thread.start();
    }
}
class MyThread2 implements Runnable{

    @Override
    public void run() {
        //具体的业务代码
        System.out.println("执行的线程为"+Thread.currentThread().getName());
    }
}